package com.akl.ssmspringboot.entity;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import lombok.Data;

import javax.validation.constraints.Min;
import java.io.Serializable;

/**
 * @ClassName: User
 * @Author: Guoxy
 * @Date: Created in 14:03 2018/11/19
 * @Version:1.0
 */
@Data
@TableName(value = "t_user")
public class User extends Model<User> {

    /**
     * 主键id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer userId;
    /**
     * 用户名
     */
    private String username;
    /**
     * 性别
     */
    private String gender;
    /**
     * 年龄
     */
    @Min(value = 18, message = "禁止未成年注册")
    private String year;
    /**
     * 地区
     */
    @TableField("area_name")
    private String areaName;
    /**
     * 邮箱
     */
    private String email;
    /**
     * 手机号
     */
    private String phone;

    @Override
    protected Serializable pkVal() {
        return this.userId;
    }
}
